package com.atguigu.yygh.user.util;

import com.atguigu.yygh.common.utils.JwtHelper;

import javax.servlet.http.HttpServletRequest;

/*==========================================
      时 间:   2022-03-14
      讲 师:   刘  辉
      描 述:   尚硅谷教学团队
 ==========================================*/
public class AuthContextHolder {

    public static  Long getUserId(HttpServletRequest request){
        String token = request.getHeader("token");
        Long userId = JwtHelper.getUserId(token);
        return userId;
    }

    public static  String getUserName(HttpServletRequest request){
        String token = request.getHeader("token");
        return JwtHelper.getUserName(token);
    }
}
